#include <stdio.h>
int main ()
{
	int n,i,t,sum=0;
	scanf("%d",&n);
	int m[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&m[i]);
		for(t=2;t<=m[i];t++)
			sum+=(t-1)*t*(t+1);
        printf("%d\n",sum);	
	}
}
